﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace com.hyrentals.webcommon.configuration
{
    public class ContentMappingConfiguration : ConfigurationSection
    {
        public static ContentMappingConfiguration Current
        {
            get
            {
                return (ContentMappingConfiguration)ConfigurationManager.GetSection("contentMapping");
            }
        }

        public string GetContentConfigParam(string name)
        {
            foreach (ContentConfigParamElement item in this.ConfigParams)
            {
                if (item.Name == name)
                {
                    return item.Value;
                }
            }

            return null;
        }

        #region Props
        [ConfigurationProperty("cfgParams", IsRequired = true)]
        public ContentConfigParamCollection ConfigParams
        {
            get
            {
                return (ContentConfigParamCollection)this["cfgParams"];
            }
            set
            {
                this["cfgParams"] = value;
            }
        }

        [ConfigurationProperty("packages", IsRequired = true)]
        public ContentPackageCollection Packages
        {
            get
            {
                return (ContentPackageCollection)this["packages"];
            }
            set
            {
                this["packages"] = value;
            }
        }
        [ConfigurationProperty("concat", IsRequired = true)]
        public ContentConcatCollection Concat
        {
            get
            {
                return (ContentConcatCollection)this["concat"];
            }
            set
            {
                this["concat"] = value;
            }
        }
        #endregion
    }
}
